1 package org.smartcomps.twister.engine.core.definition; 2 3 import junit.framework.TestCase; 4 import net.sf.hibernate.tool.hbm2ddl.SchemaExport; 5 import net.sf.hibernate.cfg.Configuration; 6 import org.smartcomps.twister.common.transaction.TransactionManager; 7 import org.smartcomps.twister.common.lifecycle.LifecycleManager; 8 import org.smartcomps.twister.util.BeanTester; 9 import org.smartcomps.twister.engine.priv.core.definition.ActivityFactory; 10 import org.smartcomps.twister.engine.priv.core.definition.Invoke; 11 import org.smartcomps.twister.engine.priv.core.definition.ProcessFactory; 12 13 public class TestInvoke extends TestCase { 14 15 public static Invoke invoke = null; 16 17 private BeanTester beanTester = new BeanTester(new String[] {"Id", "Index"}); 18 private TestProcess testProcess = new TestProcess(); 19 20 protected void setUp() throws Exception { 21 LifecycleManager.getLifecycleManager().createResources(); 22 LifecycleManager.getLifecycleManager().startResources(); 23 24 SchemaExport schemaExport = new SchemaExport(new Configuration().configure()); 25 schemaExport.create(true, true); 26 27 TransactionManager.beginTransaction(); 28 testProcess.testCreate(); 29 } 30 31 protected void tearDown() throws Exception { 32 TransactionManager.commitTransaction(); 33 34 LifecycleManager.getLifecycleManager().stopResources(); 35 LifecycleManager.getLifecycleManager().destroyResources(); 36 } 37 38 public void testCreate() throws Exception { 39 invoke = (Invoke) ActivityFactory.createActivity(Invoke.class, TestProcess.testProcess); 40 beanTester.initializeProperties("testInvoke", invoke); 41 42 TransactionManager.commitTransaction(); 43 TransactionManager.beginTransaction(); 44 45 Invoke resultInvoke = (Invoke) ProcessFactory.getByName(TestProcess.testProcess.getName()).getActivity(); 46 assertTrue("Invoke attributes values have been changed.", beanTester.testValues("testInvoke", resultInvoke)); 47 invoke = resultInvoke; 48 } 49 50 }

This page was automatically generated by Maven